package com.doit.demo03;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class test_pr {
    public static void main(String[] args) throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
        Reader r = new FileReader("day24\\class.pr");
        Properties p = new Properties();
        p.load(r);
        r.close();

        String per = p.getProperty("PresonName");
        String perM = p.getProperty("PersonMethod");

        Class c = Class.forName(per);
        Object o = c.newInstance();
        Method method = c.getMethod(perM);
        method.invoke(o);


        String stu = p.getProperty("StudentName");
        String stuM = p.getProperty("StudentMethod");

        Class c2 = Class.forName(stu);//创建字节码文件对象
        Method method1 = c2.getMethod(stuM);//得到方法
        Object o1 = c2.newInstance();//获取空参构造对象
        method1.invoke(o1);//方法运行

    }
}
